
import {
    Linking
} from 'react-native';

//使用系统浏览器访问指定URL
export const contactBrowser = (url) => {
    let murl = '';
    if (url.substring(0, 4) === 'http') {
        murl = url;
    } else {
        murl = 'https://' + url;
    }
    Linking.openURL(murl).catch(err => console.error('An error occurred', murl));
    // Linking.canOpenURL(murl).then(supported => {         
    //     if (!supported) {            
    //         console.warn('Can\'t handle url: ' + murl);            
    //     } else {            
    //         return Linking.openURL(url);            
    //     }            
    // }).catch(err => console.error('An error occurred',murl));            
}